<template>
<div class="contain">
  <div class="loader-base" v-if="showLoad"><div class="loader-wrap"></div></div>
  <header-box :title="title+'申请明细'" :hasArrow="true"></header-box>
  <detail-CtxEgress v-if="type=='5'" @showLoadDetail="showLoadDetail" :flowList="FlowList"></detail-CtxEgress>
  <detail-CtxLeave v-if="type=='4'" @showLoadDetail="showLoadDetail" :flowList="FlowList"></detail-CtxLeave>
  <detail-ctxBusTrip v-if="type=='1'" @showLoadDetail="showLoadDetail" :flowList="FlowList"></detail-ctxBusTrip>
  <detail-ctxOvertime v-if="type=='2'" @showLoadDetail="showLoadDetail" :flowList="FlowList"></detail-ctxOvertime>
  <detail-ctxReireimbursement v-if="type=='3'" @showLoadDetail="showLoadDetail" :flowList="FlowList"></detail-ctxReireimbursement>
  <progress-box @showLoadProgress="showLoadProgress" @emitNodeInfo="emitNodeInfo"></progress-box>
</div>
</template>
<script>
import progressBox from "@/components/share/progress.vue";
import detailCtxBusTrip from "@/components/share/detailCtxBusTrip.vue";
import detailCtxOvertime from "@/components/share/detailCtxOvertime.vue";
import detailCtxReireimbursement from "@/components/share/detailCtxReireimbursement.vue";
import detailCtxLeave from "@/components/share/detailCtxLeave.vue";
import detailCtxEgress from "@/components/share/detailCtxEgress.vue";
export default {
  // name:'dealtDetail',
  components:{
    progressBox,
    detailCtxBusTrip,
    detailCtxOvertime,
    detailCtxReireimbursement,
    detailCtxLeave,
    detailCtxEgress
  },
  data() {
    return {
      title:'',
      showLoadD:false,
      showLoadP:false,
      showLoad:false,
      FlowList:[],
    };
  },
  computed: {
    type(){
      return this.$route.query.type
    }
  },
  watch:{
    showLoadD(newVal, oldVal){
      if(this.showLoadD == false && this.showLoadP == false){
        this.showLoad = false;
      } else {
        this.showLoad = true;
      }
    },
    showLoadP(newVal, oldVal){
      if(this.showLoadD == false && this.showLoadP == false){
        this.showLoad = false;
      } else {
        this.showLoad = true;
      }
    },
  },
  created() {
    this.getTitle();
  },
  methods: {
    getTitle(){
      if (this.type=='4') {
        this.title = '请假'
      }else if (this.type=='1') {
        this.title = '出差'
      }else if (this.type=='2') {
        this.title = '加班'
      }else if (this.type=='3') {
        this.title = '差旅报销'
      }else if (this.type=='5') {
        this.title = '外出'
      }
    },
    showLoadDetail(val){
      this.showLoadD = val;
    },
    showLoadProgress(val){
      this.showLoadP = val;
    },
    emitNodeInfo(item){
      this.FlowList = item;
    }
  }
};
</script>